<template>
  <h4>demo</h4>
  <h4>{{ name }}</h4>
  <div class="demoBox1">
    <button>
      <span class="btn-content" @click="ceshi">动画</span>
    </button>
  </div>
  <div class="demoBox2">
    <button class="btn-content">
      点击罗亮
    </button>
  </div>
</template>

<script setup>
import { ref } from "vue"

let name = ref('我是名字')
let handleNum = ref(0)

function ceshi(){
  console.log('点击了按钮')
  handleNum.value++
  // name.value = `我变化啦${handleNum.value}`
  name = handleNum.value
  // console.log(name)
  // console.log(name.value)
}
</script>

<style lang="less" scoped>
.demoBox1{
  padding: 50px;
  min-height: 150px;
  button{
    --border_radius: 0.75em;
    font-size: 20px;
    padding: 4px;
    background-color: #000;
    border-radius: var(--border_radius);
    .btn-content{
      display: inline-block;
      padding: 0.75em;
      background-color: #fff;
      border: 2px solid #000;
      border-radius: var(--border_radius);
      transform: translateY(-0.1em);
      transition: all 0.2s ;
      
    }

    &:hover{
      .btn-content{
        transform: translateY(-0.3em)
      }
    }

    &:active{
      .btn-content{
        padding: 0.5em;
      }
    }
  }
}
.demoBox2{
  padding: 20px;
  min-height: 60px;
  button{
    position: relative;
    z-index: 1;
    font-size: 20px;
    padding: 20px 20px;
    border-radius: 28%;
    overflow: hidden;
    background-color: #000;
    color: #fff;
    transition: all 0.5s;

    &:after{
      content: '';
      position: absolute;
      z-index: -1;
      top: 0;
      bottom: 0;
      left: -20%;
      right: -20%;
      background-color: white;
      transform: skewX(-45deg) scale(0, 1);
      transition: all 0.5s;
    }
    &:hover{
      color: #000;
      transition: all 0.5s;
      &:after{
        transform: skewX(-45deg) scale(2, 1);
        transition: all 0.5s;
      }
    }
  }
}
</style>
